package com.dkm.ec.so.repository.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.dkm.base.core.helper.SpringHelper;
import com.dkm.base.db.persistence.dao.IQueryDao;
import com.dkm.biz.repository.AbstractRepository;
import com.dkm.ec.so.domain.SoAddr;
import com.dkm.ec.so.repository.SoAddrRepository;
import com.dkm.ec.so.persistence.dao.SoAddrQueryDao;
import com.dkm.ec.so.persistence.entity.SoAddrPo;

/**
 * 对象功能:订单收货地址 Repository接口的实现类
 * 开发公司:dkm.com
 * 开发人员:ZHH
 * 创建时间:2017-05-19 14:19:34
 */
@Repository
public class SoAddrRepositoryImpl extends AbstractRepository<String, SoAddrPo,SoAddr> implements SoAddrRepository{
	  
	@Resource
	private  SoAddrQueryDao soAddrQueryDao;

	public SoAddr newInstance() {
		SoAddrPo po = new SoAddrPo();
		SoAddr soAddr = SpringHelper.getBean(SoAddr.class);
		soAddr.setData(po);
		return soAddr;
	}

	public SoAddr newInstance(SoAddrPo po) {
		SoAddr soAddr = SpringHelper.getBean(SoAddr.class);
		soAddr.setData(po);
		return soAddr;
	} 
	
	@Override
	protected IQueryDao<String, SoAddrPo> getQueryDao() {
		return soAddrQueryDao;
	}

	@Override
	public List<SoAddrPo> findbyBuSoAddr(String id) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("soId", id);
		return soAddrQueryDao.findByKey("findbyBuSoAddr", params);
	}

}
